﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="addroom.aspx.cs" Inherits="CL.Admin.admin.room.addroom" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <title>新增房间</title>
    <link href="../../scripts/artdialog/ui-dialog.css" rel="stylesheet" type="text/css" />
    <link href="../skin/default/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" charset="utf-8" src="../../scripts/jquery/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../scripts/jquery/Validform_v5.3.2_min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../scripts/datepicker/WdatePicker.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../scripts/artdialog/dialog-plus-min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../editor/kindeditor-min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/laymain.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/common.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <!--导航栏-->
        <div class="location">
            <a href="news_list.aspx" class="back"><i></i><span>返回列表页</span></a>
            <a href="../center.aspx" class="home"><i></i><span>首页</span></a>
            <i class="arrow"></i>
            <a href="news_list.aspx"><span>新闻管理</span></a>
            <i class="arrow"></i>
            <span>新增房间</span>
        </div>
        <div class="line10"></div>
        <!--/导航栏-->
        <!--内容-->
        <div id="floatHead" class="content-tab-wrap">
            <div class="content-tab">
                <div class="content-tab-ul-wrap">
                    <ul>
                        <li><a class="selected" href="javascript:;">新增房间</a></li>
                    </ul>
                </div>
            </div>
            <div class="tab-content" style="height: 1024px;">
                <dl>
                    <dt>所属彩种</dt>
                    <dd>
                        <div class="rule-single-select">
                            <asp:DropDownList ID="ddlLottery" runat="server"></asp:DropDownList>
                        </div>
                    </dd>
                </dl>
                <dl>
                    <dt>房间名称</dt>
                    <dd>
                        <asp:TextBox ID="txtRoomName" runat="server" CssClass="input"></asp:TextBox>
                    </dd>
                </dl>
                <dl>
                    <dt>人数限制</dt>
                    <dd>
                        <asp:TextBox ID="txtRoomNums" runat="server" CssClass="input"></asp:TextBox>
                    </dd>
                </dl>
                <dl>
                    <dt>发言频率</dt>
                    <dd>
                        <asp:TextBox ID="txtFrequency" runat="server" CssClass="input"></asp:TextBox>(秒)
                    </dd>
                </dl>
                <dl>
                    <dt>聊天设置</dt>
                    <dd>
                        <div class="rule-single-select">
                            <asp:DropDownList ID="ddlChatSet" runat="server">
                                <asp:ListItem Value="all">无限制条件</asp:ListItem>
                                <asp:ListItem Value="full">实名认证</asp:ListItem>
                                <asp:ListItem Value="mobile">绑定手机号码</asp:ListItem>
                                <asp:ListItem Value="bank">绑定银行卡</asp:ListItem>
                            </asp:DropDownList>
                        </div>
                    </dd>
                </dl>
                <dl>
                    <dt>设置回水</dt>
                    <dd style="width: 80%;">
                        <input id="add_rebate" value="添加设置" type="button" class="link" />
                        <table border="0" class="ltable">
                            <tbody id="tb_rebate">
                                <tr>
                                    <td>最小金额</td>
                                    <td>最大金额</td>
                                    <td>回水比例(万分比)</td>
                                    <td>备注</td>
                                </tr>
                            </tbody>
                        </table>
                    </dd>
                </dl>
            </div>
            <asp:HiddenField ID="HidRebate" runat="server" />
        </div>
        <!--/内容-->
        <!--工具栏-->
        <div class="page-footer">
            <div class="btn-wrap">
                <asp:Button ID="btnSubmit" runat="server" OnClientClick="return verifyrebate();" Text="提交保存" CssClass="btn" OnClick="btnSubmit_Click" />
                <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript: history.back(-1);" />
            </div>
        </div>
        <!--/工具栏-->
        <script>
            function verifyrebate() {
                var obj_tab = $("#tb_rebate");
                var obj_length = obj_tab.children("tr").length;
                if (obj_length > 1) {
                    var rebate = "";
                    for (var i = 1; i <= obj_length - 1; i++) {
                        rebate += obj_tab.children("tr").eq(i).children("td").eq(0).html() + "^" + obj_tab.children("tr").eq(i).children("td").eq(1).html()
                               + "" + "^" + obj_tab.children("tr").eq(i).children("td").eq(2).html() + "^"
                               + obj_tab.children("tr").eq(i).children("td").eq(3).html() + "|";
                    }
                    $("#HidRebate").val(rebate);
                    return true;
                } else {
                    alert("请设置房间回水");
                    return false;
                }
            }


            $(".link").click(function () {
                var winDialog = top.dialog({
                    title: '回水设置',
                    content: $('#template_rebate').html(),
                    okValue: '确定',
                    width: 400,
                    ok: function () {
                        var minamount = $("#minamount", parent.document).val();
                        var maxamount = $("#maxamount", parent.document).val();
                        var rebates = $("#rebates", parent.document).val();
                        var remark = $("#remark", parent.document).val();
                        //简单验证
                        if (minamount == '') {
                            alert("请填写最小金额");
                            return false;
                        }
                        if (minamount == '') {
                            alert("请填写最大金额");
                            return false;
                        }
                        if (rebates == '') {
                            alert("请填写回水比例");
                            return false;
                        }
                        if (remark.indexOf("|") >= 0 || remark.indexOf("^") >= 0) {
                            alert("不能包含特殊字符|^");
                            return false;
                        }



                        var str_html = $("#tb_rebate").html();
                        str_html += "<tr><td>" + minamount + "</td><td>" + maxamount + "</td><td>" + rebates + "</td><td>" + remark + "</td></tr>";
                        $("#tb_rebate").html(str_html);
                        return true;
                    },
                    cancelValue: '取消',
                    cancel: function () {

                    }
                }).showModal();
            });
        </script>
        <script id="template_rebate" type="text/template">
            <div class="content-tab-wrap" style="height: 260px;">
                <div class="content-tab">
                    <div class="content-tab-ul-wrap">
                        <ul>
                            <li><a class="selected" href="javascript:;">回水设置</a></li>
                        </ul>
                    </div>
                </div>
                <div class="tab-content" style="height: 220px;">
                    <dl>
                        <dt>最小金额</dt>
                        <dd>
                            <input type="text" id="minamount" class="input" value="0" />
                        </dd>
                    </dl>
                    <dl>
                        <dt>最大金额</dt>
                        <dd>
                            <input type="text" id="maxamount" class="input" value="0" />
                        </dd>
                    </dl>
                    <dl>
                        <dt>比例设置(万分比)</dt>
                        <dd>
                            <input type="number" id="rebates" class="input" value="0" />
                        </dd>
                    </dl>
                    <dl>
                        <dt>备注</dt>
                        <dd>
                            <input type="text" id="remark" maxlength="50" class="input" />
                        </dd>
                    </dl>
                </div>
            </div>
        </script>
    </form>
</body>
</html>
